//
//  HotSecondTableViewCell.m
//  WangI
//
//  Created by dllo on 15/11/25.
//  Copyright © 2015年 WJN. All rights reserved.
//

#import "HotSecondTableViewCell.h"

@implementation HotSecondTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview:self.titleLabel];
        [self addSubview:self.leftImageView];
        [self addSubview:self.middleImageView];
        [self addSubview:self.rightImageView];
        [self addSubview:self.sourceLabel];
        [_titleLabel release];
        [_leftImageView release];
        [_middleImageView release];
        [_sourceLabel release];
        
    }
    return self;
}

- (void)layoutSubviews {
    self.titleLabel.frame = CGRectMake(5, 0, self.width, 20);
    NSInteger kWidth = (self.width - 20) / 3;
    self.leftImageView.frame = CGRectMake(5, self.titleLabel.bottom, kWidth, self.height- self.titleLabel.height - 20);
    self.middleImageView.frame = CGRectMake(self.leftImageView.right + 5, self.titleLabel.bottom, kWidth, self.height- self.titleLabel.height - 20);
    self.rightImageView.frame = CGRectMake(self.middleImageView.right + 5, self.titleLabel.bottom, kWidth, self.height- self.titleLabel.height - 20);
    self.sourceLabel.frame = CGRectMake(5, self.leftImageView.bottom, 50, 10);

    
    
    
    
    
}

- (void)setHotModel:(HotModel *)hotModel {
    if (_hotModel != hotModel) {
        [_hotModel release];
        _hotModel = [hotModel retain];
    }
   
    self.titleLabel.text = _hotModel.title;
    [self.leftImageView sd_setImageWithURL:[NSURL URLWithString:_hotModel.imgsrc]];
    [self.middleImageView sd_setImageWithURL:[NSURL URLWithString:[_hotModel.imgnewextra[0] valueForKey:@"imgsrc"]]];
    [self.rightImageView sd_setImageWithURL:[NSURL URLWithString:[_hotModel.imgnewextra[1] valueForKey:@"imgsrc"]]];
    self.sourceLabel.text = _hotModel.source;
//    NSLog(@"%@", _hotModel.source);
}







- (UIImageView *)leftImageView {
    if (!_leftImageView) {
        self.leftImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _leftImageView;
}

- (UIImageView *)middleImageView {
    if (!_middleImageView) {
        self.middleImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _middleImageView;
}

- (UIImageView *)rightImageView {
    if (!_rightImageView) {
        self.rightImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _rightImageView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
    
}

- (UILabel *)sourceLabel {
    if (!_sourceLabel) {
        self.sourceLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    }
    
    return _sourceLabel;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
